package com.sicheng.lc.周赛.分类.设计;

import java.util.Arrays;
import java.util.PriorityQueue;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/7/10 10:47
 */
public class 无限集中的最小数字 {
    static boolean[] st = new boolean[1001];

    static PriorityQueue<Integer> queue = new PriorityQueue<>(1001);

    {
        queue.clear();
        Arrays.fill(st, true);
        for (int i = 1; i <= 1000; i++) {
            queue.offer(i);
        }
    }

    public int popSmallest() {
        int pop = queue.poll();
        st[pop] = false;
        return pop;
    }

    public void addBack(int num) {
        if (!st[num]) {
            queue.offer(num);
            st[num] = true;
        }
    }
}
